/********************************************************************************************/
/*Pulled from the UtilityDB UtilityDB_V1R00001.sql script!									*/
/********************************************************************************************/
SET NOCOUNT ON;
declare @version smallint = 1;
declare @release smallint = 1;
declare @script_name varchar(256)
set @script_name='UtilityDB_V'+convert(varchar(5),@version)+'R'+right('00000'+convert(varchar(5),@release),5)+'.sql'
begin try
begin tran
if not exists (select 1 from sys.tables where name='database_version_information' and schema_id=schema_id('dbo')) 
BEGIN
/*--Begin Code Here --*/

	create table dbo.database_version_information (
	script_name varchar(256) not null
	,script_type varchar(20) not null
	,version_number smallInt not null
	,release_number smallInt not null
	,date_released datetime not null
	,undone bit not null
	,constraint pk_database_version_information__script_name primary key (script_name)
	,constraint un_database_version_infomration__scrypt_type__version_number__release_number unique(script_type,version_number,release_number)
	)	
	insert into dbo.database_version_information 
	values(@script_name,'UtilityDB',@version,@release,GETDATE(),0);
/********************************************************************************************/
/*Line added for this script!																*/
/********************************************************************************************/
	insert into dbo.database_version_information 
	values('UtilityDB_V2R00004.sql','UtilityDB',2,4,GETDATE(),0);
	insert into dbo.database_version_information 
	values('CensusData_V0R0000.sql','CensusData',0,0,GETDATE(),0);
/*--End Code Here --*/
END
print 'script succeeded!'
commit tran
end try
begin catch 
	declare @error_message varchar(2000);
	set @error_message='SCRIPT:'+@script_name+' FAILED! ROLLBACK!  ERROR_MESSAGE:'
	+coalesce(error_message(),'')+' ERROR_NUMBER:'+coalesce(convert(varchar(10),error_number()),'');
	ROLLBACK
	raiserror(@error_message,16,1)
end catch